package com.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.model.Interview;
import com.service.InterviewService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 面试表 前端控制器
 * </p>
 *
 * @author Damon
 * @since 2021-04-27
 */
@RestController
@RequestMapping("/interview")
public class InterviewController {
    @Autowired
    private InterviewService interviewService;

    @RequestMapping("/list")
    public Page<Interview> list(String useridS,Long pageNum, Long size){
        //分页对象
        Page<Interview> page = new Page<Interview>(pageNum, size);
        page = interviewService.listPage(page,new Interview(useridS));
        return page;
    }

//    @RequestMapping("/list")
//    public List<Interview> list() {
//        List<Interview> worklist = interviewService.list();
//        return worklist;
//    }

    @RequestMapping("/edit")
    public boolean edit(Interview interview){
        return interviewService.updateById(interview);
    }

//    @RequestMapping("/getByStatic")
//    public Interview getByStatic(Integer id){
//        return interviewService.getById(id);
//    }

    //新增
    @ApiOperation(value = "面试新增")
    @RequestMapping("/add")
    public boolean add(Interview interview){
        return interviewService.save(interview);
    }


}

